├LICKING ISN'T THE ONLY NOISE THIS MACHINE CAN DO. ╔T CAN PLAY SIMPLE TUNES AND IT CAN BE USED TO MAKE SOUNDS SUCH AS BEEPING, SWEEPING OR EXPLODING. ╘HIS PROGRAM IS A BUILDING BLOCK TO FOUR KINDS OF SOUND. ┘OU CAN MAKE A LARGER VARIETY OF SOUNDS BY SLIGHT MODIFICATIONS TO THE LISTING.
// PRG: TED SOUNDS //
Ç*FP14
*** ╓┴╥╔┴┬╠┼╙ ***
╓╠ MEMORY LOCATION IN THE ╘┼─ CHIP WHERE
WE CAN CONTROL VOLUME DURING THE SOUND
╩ ONE OF FOUR CHOICES DETERMINED BY THE...
╔$ KEYBOARD INPUT
╠1 AND ╠2 RANGE OF VALUES THE ╘┼─ CHIP WILL USE
╠╙ STEP SIZE (POSITIVE OR NEGATIVE, DEPENDING
ON ╠1 AND ╠2
╠ SOUND REGISTER VALUE RELATED TO FREQUENCY
BASED ON ╠1 TO ╠2
╬ DURATION OF SOUND
╬╙ SOUND REGISTER VALUE FOR NOISE
─ TIME DELAY VALUE
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╘O TYPE LINE 30 DO THIS: FIRST TYPE THE WORD ╔╬╨╒╘, THEN IN QUOTES TYPE FOUR WORDS: ┬╧═┬ ╠┴╬─ ┼╪╨╠╧─┼ ╒╨. ╘HEN THE SEMICOLON AND ╔$. ╬OW INSERT CURSOR-UP IN THE FIRST POSITION, AND IF YOU WISH, BUT IT IS NOT NECESSARY, INSERT ╥╓╙ BEFORE EACH FIRST LETTER OF THE WORDS, AND ╧╞╞-╥╓╙ BEFORE EACH SECOND LETTER OF THE WORDS. ╘HIS WAY THE INPUT PROMPT WILL HAVE THE FIRST LETTER HIGHLIGHTED, SUGGESTING THE LETTERS TO TYPE WHEN YOU PICK ALTERNATIVES.
╥╒╬ THE PROGRAM, AND ANSWER THE INPUT PROMPT BY PICKING ANY OF THE LETTERS: ┬ ╠ ┼ OR ╒. ┴NY OTHER KEY PERMITS YOU TO QUIT THE PROGRAM.
*** ─┼╘┴╔╠╙ ***
╘HE SOUNDS YOU HEAR ARE MY IDEA OF WHAT SHOULD BE THERE. ╔T DOES NOT MEAN THAT IT WILL AGREE WITH YOUR IDEA. ┘OU ARE FREE TO CHANGE ALL THE VALUES OR EVEN THE ENTIRE APPROACH. ╔N FACT, YOU WILL LEARN A LOT ABOUT FUNCTIONING OF THE ╘┼─ CHIP'S SOUNDMAKING MECHANISM BY PLAYING WITH THE PROGRAM.
╘HE STANDARD ╙╧╒╬─ COMMAND IS:
╙╧╒╬─ VOICE#,REGISTER VALUE,DURATION
╓OICE NUMBER 3 IS USED FOR NOISE. ╓OLUME, THE LOUDNESS OF SOUND IS NORMALLY CONTROLLED ONCE, BEFORE THE SOUND BEGINS. ┬┴╙╔├ DOS NOT PERMIT TO CHANGE THE COLUME ONCE THE SOUNDMAKER HAS BEGUN SOUNDING. ╘HIS IS NOT CONVENIENT IN MUSIC, AND IS EVEN LESS CONVENIENT IN SPECIAL EFFECTS. ╞OR EXAMPLE, EXPLOSIVE SOUND CAN'T JUST STOP ABRUPTLY, IT HAS TO DIE AWAY. ╙O WE USE A LITTLE TRICK WITH POKING THE ╘┼─'S VOLUME REGISTER IN ORDER TO BE ABLE TO CHANGE THE LOUDNESS ON THE FLY.
╘HERE ARE THREE SUBROUTINES CODED IN THIS PROGRAM. ╠INES 8000-8030 USE THE "MUSICAL VOICE" (NOT NOISE). ╘HEY SWEEP THROUGH THE RANGE OF FREQUENCIES FROM ╠1 TO ╠2 IN STEPS OF ╠╙ WHATEVER THEY MAY BE. ┴ BIT OF NOISE IS ADDED, BUT YOU CAN DELETE IT IF YOU WISH.
╠INES 8040-8070 MAKE AN EXPLOSION SOUND: THE SOUND REGISTER GETS A CONSTANT VALUE OF 300, AND A FAIRLY LONG DURATION OF 150. ╘HEN IN 8 STEPS WE DROP THE LOUDNESS FROM THE INITIAL VALUE OF 8 ALL THE WAY DOWN TO ZERO, WITH A BIT OF DELAY BETWEEN THE CHANGES.
╘HE THIRD SUBROUTINE IS THE TIME DELAY CODED IN LINE 8070. ├URRENTLY IT IS ONLY USED ONCE, BUT YOU MAY NEED IT FOR OTHER THINGS AS YOU PLAY WITH THIS PROGRAM, SO IT IS THERE TO BE USED. ╟IVE IT A ─ AND IT WILL DELAY FOR YOU.
╘HE TWO MAJOR SUBROUTINES (LINE 8000 AND 8040) ARE USED ALONE OR IN COMBINATIONS TO PRODUCE THE SOUNDS:
1. ┬OMB (╩=1): FIRST WE SWEEP THE FREQUENCY DOWNWARDS USING THE 8000 CODE, THEN WE CAUSE AN EXPLOSION SOUND USING THE 8040 ROUTINE.
2. ╠┴╬─ (╩=2): WE ALSO SWEEP THE FREQUENCY DOOWNWARDS, BUT OVER A SMALLER RANGE, AND WITH DISTINCT BREAKS IN TIMING, SO THAT IT SOUNDS LIKE A LUNAR LANDER, FOR INSTANCE, BEEP, BEEP, BEEP, UNTIL THE LANDER SETTLES ON THE SURFACE.
3. ┼╪╨╠╧─┼ (╩=3): WE JUST CALL THE 8040 ROUTINE.
4. ╒╨ (╩=4): THIS, MORE OR LESS, REVERSES THE PROCESS CODED IN LANDING, THE FREQUENCIES NOW GO UP, MAKING A SIMILAR BEEP, BEEP, BEEP SOUND.
*** ╧╬ ╙╘┴╘┼═┼╬╘ ***
╘HIS IS A USEFUL STATEMENT IN THE LANGUAGE, IT REPLACES NUMEROUS ╔╞ STATEMENTS. ╔T DISPATCHES THE PROGRAM TO ONE OF MANY LOCATIONS DEPENDING ON A GIVEN VALUE. ┘OU CAN FOLLOW THE CODE ABOVE: IF ╩ IS ONE, WE GOTO LINE 60, IF ╩ IS TWO, WE GO TO LINE 70 ... IF ╩ IS 4 WE GO TO LINE 90. ┘OU CAN PUT AS MANY SUCH ALTERNATIVES AS FIT ON A LINE. ╘HE ONLY THING TO LOOK FOR IS THAT ╩ MUST BE POSITIVE AND NOT LARGER THAN 255.
*** ╨╥╧╩┼├╘╙ ***
╔NCREASE THE REPERTOIRE OF THIS PROGRAM BY ADDING MORE OPTIONS USING THE EXISTING CODE. ┴LL YOU HAVE TO DO IS CHANGE THE PARAMETERS THAT THE SUBROUTINES NEED. ┘OU CAN PRODUCE A VARIETY OF NOISES USING WHAT HAS ALREADY BEEN CODED IN.
├ODE YOUR OWN SOUND SUBROUTINES. ╘RY TO MAKE THEM GENERAL ENOUGH THAT THEY COULD BE USED FOR MORE THAN ONE EFFECT.
╨LAY WITH THE TIME DELAYS.
├HANGE THE ─╥ VALUE TO 1. ├URRENTLY IT IS A ╠╧╟ OF ╠. ╘HIS IS COMPLETELY ARBITRARY, NOTHING MORE PROFOUND THAN A THOUGHT "╔ WONDER WHAT IT WILL SOUND LIKE IF ╔ PUT ╠╧╟ IN THERE". ╩UST MAKE SURE ─╥ IS NEVER ZERO, AS IT IS NOT VERY NICE TO TELL THE COMPUTER (OR ANYBODY) TO DIVIDE BY ZERO.